package main

import (
	"fmt"
	"unsafe"
)

func main() {
	fmt.Println(unsafe.Sizeof(float64(0))) // "8" 获取字节数

	fmt.Println(unsafe.Sizeof(a{true, 1, 2})) // "8" 获取字节数
	fmt.Println(unsafe.Sizeof(b{1, 2, true})) // "8" 获取字节数
	fmt.Println(unsafe.Sizeof(c{true, 2, 1})) // "8" 获取字节数

	//unsafe.Alignof
	fmt.Println(unsafe.Alignof(float64(1)))

	//unsafe.Pointer 返回一个特殊的指针类型
}

type a struct {
	bool
	float64
	int16
} // 3 words 4words
type b struct {
	float64
	int16
	bool
} // 2 words 3words
type c struct {
	bool
	int16
	float64
} // 2 words 3words
